<?php

namespace App\Http\Resources\Admin\V1;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class AdminResource extends JsonResource
{
    /**
     * @expalin 单条数据接口格式化
     * @param Request $request
     * @return array
     * @method
     * @author 陈文小超
     * @maxim from专注to执行
     * @time 2021/3/29/16:13
     */
    public function toArray($request)
    {
        return [
            'id'           => (int) $this->id,//管理员ID
            'name'         => (string) $this->name,//管理员名称
            'nickname'     => (string) $this->nickname,//管理员昵称
            'email'        => (string) $this->email,//管理员邮箱
            'username'     => (string) $this->username,//管理员账号
            'is_enable'    => (int) $this->is_enable,//是否启用,0:否|1:是
            'is_super'     => (int) $this->is_super,//是否超级管理,0:否|1:是
            'is_show'      => (int) $this->is_show,//应用是可见,0:否|1:是
            'expired_time' => (int) strtotime($this->expired_time),//过期时间
            'created_time' => (int) strtotime($this->created_time),//创建时间
            'updated_time' => (int) strtotime($this->updated_time),//更新时间
        ];
    }
}
